home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 013 / move13.arc / 186INST.MAC next >
Encoding:
Text File  |  1986-04-12  |  1.2 KB  |  80 lines

  1. .xlist                ; hide from .LST file
  2. .xcref                ; hide symbols from .LST & .REF files
  3. ; this file contains macros that function like
  4. ; some of the 186 (286) instructions
  5. .xcref enter
  6. ; the level function not fully tested yet
  7. enter    macro locals,level
  8.     push bp
  9.     if level
  10.     .xcref ._level_
  11.     ._level_ = level - 1
  12.     if ._level_ 
  13.     mov ax,sp
  14.     .xcref ._levelc_
  15.     ._levelc_ = 1
  16.     rept _level
  17.     push [bp-2*._levelc_]
  18.     ._levelc_ = ._levelc_+1
  19.     endm
  20.     push ax
  21.     mov bp,ax
  22.     else
  23.     mov bp,sp
  24.     push bp
  25.     endif
  26.     else
  27.     mov bp,sp
  28.     endif
  29.     if locals 
  30.     sub sp,locals
  31.     endif
  32. endm
  33. .xcref leave
  34. leave    macro
  35.     mov sp,bp
  36.     pop bp
  37. endm
  38. .xcref pusha
  39. pusha    macro
  40.     push ax
  41.     push cx
  42.     push dx
  43.     push bx
  44.     xchg bx,bp    ;; make effort to push sp
  45.     mov bp,sp
  46.     lea bp,[bp+8]    ;; point to before ax
  47.     push bp
  48.     mov bp,[bp-8]
  49.     xchg bx,bp    ;; all done show no sign
  50.     push bp
  51.     push si
  52.     push di
  53. endm
  54. .xcref popa
  55. popa    macro
  56.     pop di
  57.     pop si
  58.     pop bp
  59.     pop bx        ;; ignore pop sp
  60.     pop bx
  61.     pop dx
  62.     pop cx
  63.     pop ax
  64. endm
  65. .xcref bound
  66. bound    macro reg,range
  67.     local bound_int,bound_cont
  68.     pushf
  69.     cmp reg,word ptr range
  70.     jl bound_int
  71.     cmp reg,word ptr range+2
  72.     jle bound_cont
  73. bound_int:
  74.     int 5
  75. bound_cont:
  76.     popf
  77. endm
  78. .cref
  79. .list
  80.